package AdapterPattern;

public class Adapter implements Cat,Dog{
    private Cat cat;
    private Dog dog;

    public Cat getCat() {
        return cat;
    }
    public void setCat(Cat cat) {
        this.cat = cat;
    }
    public Dog getDog() {
        return dog;
    }
    public void setDog(Dog dog) {
        this.dog = dog;
    }

    public void catCry() { //猫学狗叫
        System.out.print("小猫学小狗：");
        dog.dogCry();
    }
    public void catchMouse() {
        cat.catchMouse();
    }
    public void dogCry() {
        dog.dogCry();
    }
    public void action() { //狗学猫抓老鼠
        System.out.print("小狗学小猫：");
        cat.catchMouse();
    }
}
